cmake_minimum_required(VERSION 3.5.0)
project(polynomial_trajectories)

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
# find_package(builtin_interfaces REQUIRED)
find_package(rotor_swarm_msgs REQUIRED)
find_package(quadrotor_common REQUIRED)
find_package(Eigen3 REQUIRED)

include_directories(${EIGEN3_INCLUDE_DIRS})
include_directories("/usr/include/eigen3")
include_directories(
    # "include/polynomial_trajectories/"
    include
    ${rotor_swarm_msgs_INCLUDE_DIRS}
    ${quadrotor_common_INCLUDE_DIRS}
    )

add_library(polynomial_trajectories SHARED
    src/polynomial_trajectory.cpp
    src/polynomial_trajectories_common.cpp
    src/minimum_snap_trajectories.cpp
    src/constrained_polynomial_trajectories.cpp
    # include/polynomial_trajectories/polynomial_trajectory.h
    # include/polynomial_trajectories/polynomial_trajectories_common.h
    # include/polynomial_trajectories/polynomial_trajectory_settings.h
    # include/polynomial_trajectories/minimum_snap_trajectories.h
    # include/polynomial_trajectories/constrained_polynomial_trajectories.h
    include/polynomial_trajectory.h
    include/polynomial_trajectories_common.h
    include/polynomial_trajectory_settings.h
    include/minimum_snap_trajectories.h
    include/constrained_polynomial_trajectories.h
)

# target_link_libraries(${PROJECT_NAME}
#     rclcpp
#     geometry_msgs
#     nav_msgs
#     rotor_swarm_msgs
#     quadrotor_common
#     )

ament_target_dependencies(
    polynomial_trajectories
    "rclcpp"
    "nav_msgs"
    "rotor_swarm_msgs"
    "quadrotor_common"
    "geometry_msgs"
    "Eigen3"
    )
  
ament_export_targets(polynomial_trajectories HAS_LIBRARY_TARGET)
ament_export_dependencies(
        rclcpp
)

install(
    TARGETS polynomial_trajectories
    EXPORT polynomial_trajectories
    ARCHIVE DESTINATION lib
    LIBRARY DESTINATION lib
    RUNTIME DESTINATION bin
    INCLUDES DESTINATION include
)

install(
    DIRECTORY include/
    DESTINATION include/${PROJECT_NAME}
    # DESTINATION include
)

ament_package()